package com.hiwhitley.easy.day11;

import com.hiwhitley.base.ListNode;

/**
 * Created by hiwhitley on 2016/8/15.
 */
public class DeleteDuplicates {
    public ListNode deleteDuplicates(ListNode head) {
        if (head == null || head.next == null) return head;
        ListNode curr = head;
        while (curr != null) {
            if (curr.next == null)
                break;
            if (curr.val == curr.next.val) {
                curr.next = curr.next.next;
            } else {
                curr = curr.next;
            }
        }
        return head;
    }
}
